<?php namespace App\Model\Admin;

use think\Model;
/**
 * 使用tp的ORM
 * tirin
 */
class Common extends Model
{

    //返回分頁
    public function getList($params = null)
    {
        $field = $this->listField?:'*';
        extract($params);
        return $this->where($where)->field($field)->paginate(['list_rows'=>$page['per_page'],'page'=>$page['current_page']],false);
    }

    public function add()
    {
        
    }
    public function edit()
    {
        
    }
    public function getUuidAttr($value)
    {
        return (strtotime(date('YmdHis', time()))) . substr(microtime(), 2, 6) . sprintf('%03d', rand(0, 999));
    }
}